import QtQuick 2.6
import QtQuick.Window 2.1

Window {
    id: dropdown


    flags: Qt.Popup
    default property alias data: fscope.data

    function open(rect) {
        if (rect) {
            dropdown.x = rect.x
            dropdown.y = rect.y
            dropdown.width = rect.width
            dropdown.height = rect.height
        }

        dropdown.flags = Qt.Window
        dropdown.visible = true;
        dropdown.flags = Qt.Popup
    }

    FocusScope {
        id: fscope
        anchors.fill: parent
        focus: true
        onActiveFocusChanged: {
            if (!activeFocus) {
                dropdown.visible = false;
            }
        }


    }
}
